//
//  MSNetEngine.h
//  MyShare
//
//  Created by koki on 15/9/14.
//  Copyright (c) 2015年 MyShare. All rights reserved.
//

//**************服务地址&请求地址**************************/

//微信appkey
#define wechatAppID                 @"wxeece9f3e0dd737a7"
#define wechatAppSecret             @"0443bccd0b053f6769535408ff09c6d9"
//新浪appKey
#define sinaAppKey                  @"2398516041"
#define sinaAppSecret               @"9111d7fd0179a5d6f2f80baa40861f5d"
//QQappKey
#define QQAppKey                    @"1105000902"
#define QQAppSecret                 @"HJu6t5FR8H2SVoe2"

#define UMENG_APPKEY                @"5705d27167e58e4de200213a"         //预生产统计的key
// 友盟分享APP key      585b39d9cae7e70e980010e4

#define TEST            //测试
//#define PREPRODUCT      //预生产
//#define PRODUCT         //正式

#ifdef TEST

#define hostUrl             @"http://114.215.124.162:8080"         //测试服务器地址

#elif defined PREPRODUCT


#elif defined PRODUCT


#endif


#import <Foundation/Foundation.h>

@interface MSNetEngine : NSObject
@property(nonatomic,strong)NSLock* cdlock;
@property(nonatomic,strong)NSOperationQueue *netQueue;
@property(nonatomic,strong)NSMutableArray *addCollectionList;
@property(nonatomic,strong)NSMutableArray *deleteCollectionList;
@property(nonatomic,strong)NSMutableDictionary *requestSerializerDic;
@property(nonatomic,strong)NSMutableDictionary *responseSerializerDic;
@property(nonatomic,strong)NSString *appInfoForRequestHeader;

@property(nonatomic,copy) NSString *sessionId;
@property(nonatomic,strong)NSArray *chinaAreaArray;
@property(nonatomic,strong)NSArray *provincesArray;
@property(nonatomic,strong)NSArray *projectStateArray;
@property(nonatomic,strong)NSArray *projectInvestmentArray;
@property(nonatomic,strong)NSArray *projectTimeArray;
@property(nonatomic,strong)NSArray *projectIndustryArray;
@property(nonatomic,strong)NSArray *contactsCorrectArray;
@property(nonatomic,strong)NSArray *tradeTypeArray;
@property(nonatomic,strong)NSArray *tradeStateArray;
@property(nonatomic,strong)NSArray *tradeKindArray;
+(MSNetEngine*)sharedInstance;

/**
 *  显示错误信息
 *
 *  @param error 错误对象
 */
- (void)showErrorMessge:(NSError*)error;

/**
 *  GET请求
 *
 *  @param URLString  请求url
 *  @param parameters 请求参数
 *  @param hudView    请求状态显示的view
 *  @param success    请求成功的回调
 *  @param failure    请求失败的回调
 *
 */
- (void)GET:(NSString *)URLString
        parameters:(id)parameters
        hudView:(UIView *)hudView
        success:(void (^)(NSURLSessionDataTask * task, id responseObject))success
        failure:(void (^)(NSURLSessionDataTask * task, NSError * error))failure;


/**
 *  POST请求
 *
 *  @param URLString  请求url
 *  @param parameters 请求参数
 *  @param hudView    请求状态显示的view
 *  @param success    请求成功的回调
 *  @param failure    请求失败的回调
 */
- (void)POST:(NSString *)URLString
        parameters:(id)parameters
        hudView:(UIView *)hudView
        success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
        failure:(void (^)(AFHTTPRequestOperation * operation, NSError *error))failure;

/**
 *  POST请求
 *
 *  @param URLString  请求url
 *  @param parameters 请求参数
 *  @param hudView    请求状态显示的view
 *  @param constructing 添加post的formdata数据
 *  @param success    请求成功的回调
 *  @param failure    请求失败的回调
 */
- (void)POST:(NSString *)URLString
        parameters:(id)parameters
        hudView:(UIView *)hudView
        constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
        success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
        failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;


/**
 *  DELETE请求
 *
 *  @param URLString  请求url
 *  @param parameters 请求参数
 *  @param hudView    请求状态显示的view
 *  @param success    请求成功的回调
 *  @param failure    请求失败的回调
 */
- (void)DELETE:(NSString *)URLString
        parameters:(id)parameters
        hudView:(UIView *)hudView
        success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
        failure:(void (^)(AFHTTPRequestOperation * operation, NSError *error))failure;

/**
 *  PUT请求
 *
 *  @param URLString  请求url
 *  @param parameters 请求参数
 *  @param hudView    请求状态显示的view
 *  @param success    请求成功的回调
 *  @param failure    请求失败的回调
 */
- (void)PUT:(NSString *)URLString
        parameters:(id)parameters
        hudView:(UIView *)hudView
        success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
        failure:(void (^)(AFHTTPRequestOperation * operation, NSError *error))failure;

@end

